package com.yxq.mdt.app.modules.personal.adapter;

import android.text.TextUtils;

import com.blankj.utilcode.util.TimeUtils;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yxq.mdt.app.R;
import com.yxq.mdt.app.glide.GlideHelper;
import com.yxq.mdt.app.modules.goodsdetail.bean.GoodsCommentBean;
import com.yxq.mdt.app.modules.personal.bean.MainPersonalBean;
import com.yxq.mdt.app.modules.personal.bean.MainPersonalStateBean;

import java.text.SimpleDateFormat;
import java.util.List;

/**
 * @author L
 * @time
 * @describe 我的回复
 */
public class MyReplyCommentListAdapter extends BaseQuickAdapter<MainPersonalStateBean.ListBean.ChiledrenListBean, BaseViewHolder> {

    public MyReplyCommentListAdapter(int layoutResId, List<MainPersonalStateBean.ListBean.ChiledrenListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MainPersonalStateBean.ListBean.ChiledrenListBean item) {
        GlideHelper.setLoadImage(mContext, item.getHeadimg(), R.color.gray, helper.getView(R.id.personal_item_img));
        helper.setText(R.id.item_layout_time, TimeUtils.getFriendlyTimeSpanByNow(item.getCreateDate(), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")));
        helper.setText(R.id.item_number_tv, item.getContent());
        if (!TextUtils.isEmpty(item.getUserName())) {
            helper.setText(R.id.item_layout_nike_name, item.getUserName());
        } else {
            helper.setText(R.id.item_layout_nike_name, "yxq" + item.getUserId());
        }
        helper.addOnClickListener(R.id.item_layout_nike_name);
        helper.addOnClickListener(R.id.item_reply);
    }
}
